<?php

function __autoload($file_name) {

    $dirArr = array('/classes/', '/dbClasses/', '/viewComponents/');
	
	$commArr = array('category', 'home-page', 'index','logout');
    // iterate through each possible
    foreach ($dirArr as $dir) {
        if (file_exists(CLASS_PATH.$dir . 'class.'. $file_name .'.php')) {
            require_once CLASS_PATH.$dir . 'class.'. $file_name .'.php';
            return true;
        }
    }
	
	foreach ($commArr as $subDir) {
		if (file_exists(CLASS_PATH.'/content/'.$subDir . '/class.'. $file_name .'.php')) {
            require_once CLASS_PATH.'/content/'.$subDir . '/class.'. $file_name .'.php';
            return true;
        }
	}
	
    // doesn't exist
    die ($file_name .' does not exist');

}